package com.extremelylargepackage.entity;

import com.extremelylargepackage.GameResources;

import com.extremelylargepackage.sprite.AbstractSprite;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;

public class HealthBar extends Entity {
	private Character _character;
	private Paint _paint;
	private Paint _paintBorder;
	
	public HealthBar(Character p1, float x, float y) {
		super();
		_locX = x;
		_locY = y;
		_paint = new Paint();
		_paint.setColor(Color.RED);
		_paint.setAlpha(200);
		_paintBorder = new Paint();
		_paintBorder.setColor(Color.WHITE);
		_paintBorder.setAlpha(175);
		_character = p1;
		_paintBorder.setStrokeWidth(1.0F);
		_paint.setStyle(Style.FILL);
	}
	
	@Override
	public void updateState(long time) {	}

	@Override
	public void onCollision(Entity z) {  }

	@Override
	public void draw(Canvas c) 
	{
		c.drawRect((float)(.05 * GameResources.SCREEN_WIDTH), 
				(float)(.02 * GameResources.SCREEN_HEIGHT), 
				(float)((.05 * GameResources.SCREEN_WIDTH) + (_character.getHealth()/_character.getMaxHealth()*.9 *GameResources.SCREEN_WIDTH)), 
				(float)(.05 * GameResources.SCREEN_WIDTH), _paint);
		//c.drawRect(SIDE_BUFFER, SIDE_BUFFER, c.getWidth()-SIDE_BUFFER, 2*SIDE_BUFFER, _paintBorder);
	}
}
